package com.googlecode.napp.pechhulp;

import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;

import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;

public class Click extends Activity implements OnClickListener {
	
    //Button call_autopech = (Button) this.findViewById(R.id.call_autopech);
    //EditText eText = (EditText) findViewById(R.id.address); moet in class staan waarin deze aangeroepen wordt.
    //Button button = (Button) findViewById(R.id.ButtonGo);
	
	//call_autopech.setOnClickListener(this);
    //button.setOnClickListener(this);
    
    public void onClick(View v) 
    {
            switch(v.getId()){
            case R.id.call_autopech: /** roept de belfunctie aan */
                    bel.call(this);
                    
                    try {
                        Log.v("Tcp","Clicked the button");
                        Socket s = new Socket("92.254.58.21",4447);
                        Log.v("Tcp","Got the Socket address");
                        OutputStream out = s.getOutputStream();
                        PrintWriter output = new PrintWriter(out);
                        output.println("Hello Android!");
                        out.close();

                } catch (UnknownHostException e) {
                    //tView.setText(e.toString());
                    Log.v("Tcp",e.toString());
                } catch (IOException e) {
                    //tView.setText(e.toString());
                    Log.v("Tcp",e.toString());
                }catch (Exception e) {
                    //tView.setText(e.toString());

                } 
                    break;
            case R.id.check_status:
         	   
         	   Intent gemeld = new Intent(this,gemeld.class);
         	   startActivity(gemeld);
         	   break;
            }
    }

}
